/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hoja5;
import java.util.LinkedList;
import java.util.List;
/**
 *
 * @author Ero
 */
public class Cola<E> extends AbsQueue<E> {
    private int tail, head;
    private List<E> lista;
    
    public Cola(int size){
        super(size);
        tail=0;
        cont++;
        lista=new LinkedList<E>();
    }
    @Override
    public void add(E item) {
        if(!this.isFull()){
            lista.add(item);
            cont++;
            tail++;
        }else
        {
            System.out.print("Cola llena");
        }
    }

    @Override
    public E remove() {
        if(!this.isEmpty()){
            E temp;
            cont--;
            tail--;
            temp=lista.get(0);
            lista.remove(0);
            for(int x=0; x<tam; x++){
                lista.set(x, lista.get(x+1));
            }
            return temp;
        }else{
            return null;
        }
        
    }

    @Override
    public E peek() {
        return lista.get(0);
    }

  
}
